//
//  ABSCategoryHeaderReusableView.m
//  商品分类列表信息处理
//
//  Created by 我演示 on 2019/10/30.
//  Copyright © 2019 ALLSall. All rights reserved.
//

#import "ABSCategoryHeaderReusableView.h"
#import "UILabel+FSLLabel.h"


@interface ABSCategoryHeaderReusableView ()

/**label*/
@property(nonatomic,weak) UILabel  *nameLabel ;

/**uiview*/
@property(nonatomic,weak) UIView *leftView ;

/**右侧View*/
@property(nonatomic,weak) UIView *rightView ;

@end

@implementation ABSCategoryHeaderReusableView

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        [self makeUpUI];
        
    }
    return self;
}
-(void)makeUpUI{
    UILabel *label = [[UILabel  alloc] initWithTextString:@"测试" andTextColor:[UIColor colorWithHexString:@"#666666"] andTextFont:15];
    label.textAlignment = NSTextAlignmentCenter ;

    [self addSubview:label];
    self.nameLabel = label;
    
    UIView  *leftView = [[UIView alloc ] init];
    leftView.backgroundColor  = [UIColor colorWithHexString:@"#999999"];
    
    [self addSubview:leftView];
    self.leftView = leftView ;
    
    /** 右侧的View*/
    UIView *rightView =  [[UIView alloc] init];
     rightView.backgroundColor  = [UIColor colorWithHexString:@"#999999"];
    [self addSubview:rightView];
    self.rightView = rightView;
    
    
    
}
-(void)setModel:(ABSCategorySecondModel *)model {
    _model = model ;
    self.nameLabel.text = model.categoryName;
    
}
-(void)layoutSubviews {
    [super layoutSubviews];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).offset(0);
        make.centerY.equalTo(self.mas_centerY).offset(0);
        make.width.offset(70);
        make.height.equalTo(self.mas_height);
        
    }];
    
    
    /** 布局*/
    
    [self.leftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.nameLabel.mas_left).offset(-5);
        make.height.offset(0.5);
        make.width.offset(25);
        make.centerY.equalTo(self.mas_centerY).offset(0);
        
    }];
    [self.rightView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel.mas_right).offset(5);
        make.height.offset(0.5);
        make.width.offset(25);
        make.centerY.equalTo(self.mas_centerY).offset(0);
        
    }];
}

@end
